import { Body, Controller, Get, Query, Post } from '@nestjs/common';
import { UserService } from './user.service';
import { CreateUserDto } from './dto/create-user.dto';

@Controller('user')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Get('user-info')
  async getUser(@Query() query: { id: number }) {
    return this.userService.findOne(query.id);
  }

  @Get('user-list')
  getUserAll() {
    return this.userService.findAll();
  }

  @Post()
  createUser(@Body() createUserDto: CreateUserDto) {
    return this.userService.create(createUserDto);
  }
}
